<template>
    <div>
        <h1>登录</h1>
        <table class="table" border="1">
            <tr>
                <td>用户名</td>
                <td><input type="text" placeholder="请输入用户名" v-model="username"/></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" placeholder="请输入密码" v-model="password"/></td>
            </tr>  
            <tr>
                <td colspan="2"><button @click="login">登录</button></td>
            </tr>
        </table>
    </div>
</template>
<script setup lang="ts">


import { ref } from 'vue';

let username = ref('');
let password = ref('');



import { useRouter } from 'vue-router';

const router = useRouter();


function login(){

if(username.value == ''){
    alert('用户名不能为空');
    return;
}

if(password.value == ''){
    alert('密码不能为空')
    return;
}   

if(username.value == 'admin' && password.value == '123456')
{
    alert("登录成功");
    router.push('/LoginShow');
}
else{
    alert("登录错误");
    return;
}

}
</script>
